import { ApiCall } from "tsrpc";
import { ReqStart, ResStart } from "../../../../shared/master/minGame/Lottery/PtlStart";
import { player } from "../../../../model/fight/body/player";
import Lottery from "./Lottery";

export default async function (call: ApiCall<ReqStart, ResStart>) {
    call.succ({})
    let user = call.req._player as player;
    if(call.req.gold == 0){
        user.callApi('minGame/Lottery/Menu',{})
        return;
    }
    if(call.req.gold < 100){
        call.req.gold = 100;
    }
    let res = user.check_wallet(call.req.gold, 0, [], false, '澳门·金币抽奖', true);
    if (!res.state) {
        return;
    }
    Lottery.start(user,call.req.gold)
}